namespace DataClasses
{
    using System;

    /// <summary>
    /// Model of genre
    /// </summary>
    public class Genre : ActiveRecord<Genre>
    {
        /// <summary>
        /// Empty constructor
        /// </summary>
        public Genre() { }

        /// <summary>
        /// Simple constructor of genre
        /// </summary>
        /// <param name="name"></param>
        public Genre(string name)
        {
            Id = Guid.NewGuid();
            Name = name;
            Save();
        }

        public Genre(Guid self, string name)
        {
            Id = self;
            Name = name;
        }

        /// <summary>
        /// Name of genre
        /// </summary>
        public string Name { get; set; }

        public override object[] Objparams
        {
            get
            {
                objects = new object[2];
                objects[0] = Id.ToString();
                objects[1] = Name;
                return objects;
            }

            set
            {
                objects = value;
                Id = new Guid(objects[0].ToString());
                Name = (string)objects[1];
            }
        }
    }
}
